<!DOCTYPE html>
<html 
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head></h:head>
<body>
		<h:form id="formComboBebidas">

			<p:growl id="msgs" showDetail="true" life="1000" />
			<p:panel header="Combo de Bebidas" style="border: none;">

				<p:dataTable id="singleDT" var="cb" value="#{comboBebidaBean.listaComboBebidas}"
					selection="#{comboBebidaBean.selectedComboBebida}" rowKey="#{cb.nombreComboBebida}"
					editable="true" style="width:100%" rows="4" paginator="true"
					paginatorPosition="bottom"
					paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}">

					<p:ajax event="rowEdit" listener="#{comboBebidaBean.onRowEdit}"
						update=":#{p:component('msgs')}" />
					<p:ajax event="rowEditCancel" listener="#{comboBebidaBean.onRowCancel}"
						update=":#{p:component('msgs')}" />

					<f:facet name="header">
						<p:outputPanel style="text-align:right">
							<h:outputText value="Buscar: " />
							<p:inputText id="globalFilter" onkeyup="PF('comboBebidaTable').filter()"
								style="width:150px" placeholder="Ingrese Combo Bebida" />
						</p:outputPanel>
					</f:facet>

					<p:column headerText="Nombre" style="text-align:left">
						<p:cellEditor>
							<f:facet name="output">
								<h:outputText value="#{cb.nombreCombo}" />
							</f:facet>
							<f:facet name="input">
								<p:inputText id="modelInput" value="#{cb.nombreCombo}"
									style="width:100%" />
							</f:facet>
						</p:cellEditor>
					</p:column>
					<p:column headerText="Descripción" style="text-align:left">
						<p:cellEditor>
							<f:facet name="output">
								<h:outputText value="#{cb.descipcionCombo}" />
							</f:facet>
							<f:facet name="input">
								<p:inputText id="modelInput" value="#{cb.descipcionCombo}"
									style="width:100%" />
							</f:facet>
						</p:cellEditor>
					</p:column>
									
					
					<p:column headerText="Modificar"
						style="width:70px;text-align: center">
						<p:rowEditor />
					</p:column>

					<p:column headerText="Eliminar"
						style="width:32px;text-align: center">
						<p:commandButton process="singleDT"
							update=":#{p:component('singleDT')}" icon="ui-icon-close"
							title="View" action="#{comboBebidaBean.eliminarComboBebida}">
							<f:setPropertyActionListener value="#{be}"
								target="#{comboBebidaBean.selectedComboBebida}" />

							<p:confirm header="Confirmación" message="Está seguro?"
								icon="ui-icon-alert" />
						</p:commandButton>
					</p:column>

				</p:dataTable>

				<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
					<p:commandButton value="Si" type="button"
						styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
					<p:commandButton value="No" type="button"
						styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
				</p:confirmDialog>

				<br />

    </p:panel>
		</h:form>

</body>
</html>